package com.daocheng.weblog.admin.controller;

import com.daocheng.weblog.admin.model.vo.categroy.AddCategoryReqVO;
import com.daocheng.weblog.admin.model.vo.categroy.DeleteCategoryReqVO;
import com.daocheng.weblog.admin.model.vo.categroy.FindCategoryPageListReqVO;
import com.daocheng.weblog.admin.model.vo.tag.AddTagReqVO;
import com.daocheng.weblog.admin.model.vo.tag.DeleteTagReqVO;
import com.daocheng.weblog.admin.model.vo.tag.FindTagPageListReqVO;
import com.daocheng.weblog.admin.model.vo.tag.SearchTagsReqVO;
import com.daocheng.weblog.admin.service.AdminCategoryService;
import com.daocheng.weblog.admin.service.AdminTagService;
import com.daocheng.weblog.common.aspect.ApiOperationLog;
import com.daocheng.weblog.common.utils.Response;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @ClassName AdminTagController
 * @author: 稻城
 * @date: 2025/3/10
 * @Version 1.0
 * @description: TODO
 */
@RestController
@RequestMapping("/admin")
@Api(tags = "Admin 标签模块")
public class AdminTagController {
    @Autowired
    private AdminTagService adminTagService;

    @PostMapping("/tag/add")
    @ApiOperation(value = "添加分类")
    @ApiOperationLog(description = "添加分类")
    public Response addTags(@RequestBody @Validated AddTagReqVO addTagReqVO) {
        return adminTagService.addTags(addTagReqVO);
    }


    @PostMapping("/tag/list")
    @ApiOperation(value = "分页获取分类数据")
    @ApiOperationLog(description = "分页获取分类数据")
    public Response findTagPageList(@RequestBody @Validated FindTagPageListReqVO findTagPageListReqVO) {
        return adminTagService.findTagPageList(findTagPageListReqVO);
    }

    @PostMapping("/tag/delete")
    @ApiOperation(value = "删除分类数据")
    @ApiOperationLog(description = "删除分类数据")
    public Response deleteTag(@RequestBody @Validated DeleteTagReqVO deleteTagReqVO) {
        return adminTagService.deleteTag(deleteTagReqVO);
    }

    @PostMapping("/tag/search")
    @ApiOperation(value = "标签模糊查询")
    @ApiOperationLog(description = "标签模糊查询")
    public Response searchTags(@RequestBody @Validated SearchTagsReqVO searchTagsReqVO) {
        return adminTagService.searchTags(searchTagsReqVO);
    }
    @PostMapping("/tag/select/list")
    @ApiOperation(value = "查询标签 Select 列表数据")
    @ApiOperationLog(description = "查询标签 Select 列表数据")
    public Response findTagSelectList() {
        return adminTagService.findTagSelectList();
    }
}
